package DataStructuresTest.BinaryTree;

public class AVLTree<AnyType> {
    //创建一个AvlNode类,声明一个AvlNode节点
    private static class AvlNode<AnyType>{
        //constructors
        AvlNode(AnyType theElement){
            this(theElement,null,null);
        }

        AvlNode(AnyType theElement,AvlNode<AnyType> lt,AvlNode<AnyType> rt){
            element = theElement;left = lt;right = rt;
        }

        AnyType          element;   //the data in the node
        AvlNode<AnyType> left;      //left child
        AvlNode<AnyType> right;     //right child
        int              height;    //Height

        //return the height of node t,if null return -1
        private int height(AvlNode<AnyType> t){
            return t == null ? -1 : t.height;
        }
    }



    /**
     * internal method to insert into a subtree
     *
     */
    private AvlNode<AnyType> insert(AnyType x,AvlNode<AnyType> t){
        if (t==null){
            return new AvlNode<>(x,null,null);
        }

//        int compareResult = x < t.element ? -1 :(x==t.element ? 0:1);
        return null;
    }
}
